<template>
    <!-- 设置垂直间距 -->
    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active" @change="onChange"v-for="item in fandata">
                <van-sidebar-item :title="item.cat_name" />
            </van-sidebar>

        </van-col>
        <van-col span="18">
            <div v-for="items in fandata[active]?.children">
                <h4>{{ items.cat_name }}</h4>
                <van-grid>
                    <van-grid-item v-for="itemall in items.children" :icon="itemall.cat_icon"
                        :text="itemall.cat_name" />
                </van-grid>

            </div>

        </van-col>
    </van-row>




</template>

<script setup>
import { categoriesApi } from '@/api/api'
import { ref } from 'vue';
  const active = ref(0);
let fandata = ref([])
categoriesApi().then(res => {
    console.log('分类数据', res);
    fandata.value = res.data.message
})
</script>

<style lang="scss" scoped></style>